import matplotlib.pyplot as plt
#解决中文显示问题
plt.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体
plt.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题
import load2

fig = plt.figure()
ax = fig.add_subplot(111)

allScore=[]
allSciScore=[]
allDiff=[]

for i in range(1,1091):
    Score = load2.getCell(i, load2.totScore)
    SciScore = load2.getCell(i, load2.SciScore)
    if Score=='':
        continue
    else:
        Score=float(Score)
        SciScore=float(SciScore)
        if Score!=0 and SciScore!=0:
            allScore.append(Score)
            allSciScore.append(SciScore)
            allDiff.append(float(load2.getCell(i, load2.SchoolDiff)))

ax.scatter(allScore,allDiff,c='red',label='原总分为横坐标') # 以原分数为横坐标
ax.scatter(allSciScore,allDiff,c='green',label='理科分数为横坐标') # 以理科分数为横坐标
ax.set_title('分数与排名差关系')
plt.legend()
plt.show()